#ifndef __WORDPROCESS_H__
#define __WORDPROCESS_H__

#include<fstream>
#include<vector>
#include<ext/hash_map>

using namespace std;
using __gnu_cxx::hash_map;

static inline size_t wp_hash_string(const char* s)
{
	unsigned long h = 0;
	for ( ; *s; ++s)
		h = 5 * h + *s;
	return size_t(h);
}

struct wp_string_hash
{
	size_t operator()(const string& s) const
	{
		return wp_hash_string(s.c_str());
	}
};


extern hash_map<int, vector<int> > i2w, w2i;
extern hash_map<int, string> id_word;
extern hash_map<string, int, wp_string_hash> word_id;

void LoadWords(const char*);
void LoadItems(const char*, const int, const int);
int LoadSimtable(const char *);
void CalWordSim(const int, const int); 
void Emitcfscore(const char*);
void EmitItemWord(const char*);
void CalSim(const int, const float, const int, const char*);
void EmitNewSim(const char*);
void Clustering(const char *, const float, const int, const int);

#endif
